﻿using System;
using System.Drawing;
using System.Collections.Generic;

using iPhoneUI.Shell;

namespace iPhoneUI.Widgets
{
    public class IImageWidget : Widget
    {
        private IImage m_image;

        public IImageWidget()
        {
        }

        public IImage Image
        {
            get
            {
                return m_image;
            }
            set
            {
                m_image = value;
                if (m_image != null)
                    Size = m_image.Size();
            }
        }

        protected override void OnDraw(Canvas canvas, Rectangle clipBounds)
        {
            if (m_image != null)
                canvas.AlphaBlend(m_image, ClientArea);
        }

        protected override void OnDispose()
        {
            m_image = null;
            base.OnDispose();
        }
    }
}